#pragma once
#include <string>

class CMainDlg;

class CLinkED_UDP
{
public:
    CLinkED_UDP(void);
    ~CLinkED_UDP(void);

    bool Init(CMainDlg* mainpage, std::string& ip, unsigned short port);
    void Fini();

private:
    static CLinkED_UDP* m_pInstance;
    bool IntialUDPBind(std::string& ip, unsigned short port);
    CMainDlg* m_MainPage;
    SOCKET m_Socket;
    HANDLE m_ReceiveThreadHandle;

    bool StartReceiveThread();
    void StopReceiveThread();

    static DWORD WINAPI UDPReceiveThreadFunc(LPVOID userdata);

};

